#include "stdafx.h"
#include "Tree.h"

using namespace aiRobots;

Tree::Tree()
{
	Parent = NULL;
	Sibling = NULL;
	Child = NULL;
}

Tree::Tree(Node* parent)
{
	Parent = parent;
	Sibling = NULL;
	Child = NULL;
}

Tree::~Tree()
{
	if(Parent != NULL)
	{
		Parent->I
	}
	delete Child;
}

bool Tree::IsRoot()
{
	if(Parent == NULL)
	{
		return true;
	}
	else
	{
		return false;
	}
}

bool Tree::IsLeaf()
{
	if(Child == NULL)
	{
		return true;
	}
	else
	{
		return false;
	}
}

void Tree::InsertChild(Node* child)
{
	if(Child == NULL)
	{
		Child = child;
	}
	else
	{
		Child->InsertSibling(child);
	}
}

void Tree::InsertSibling(Node* sibling)
{
	if(Sibling == NULL)
	{
		Sibling = sibling;
	}
	else
	{
		Sibling->InsertSibling(sibling);
	}
}